package com.cnxdc.demo.controller;

import com.cnxdc.demo.service.UserService;
import com.cnxdc.demo.vo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    UserService userService;
    @RequestMapping("/add")
    public String add(@RequestBody User user){
        System.out.println(user.getName()+" "+user.getPassword());
        userService.add(user);
        return "添加成功";
    }
}
